<template>
	<view class="mainpadding2">
		<view class="flexcolumn" v-if="list.data.length==0">
			<view class="placeholderimage" style="margin-top: 200rpx;"></view>
			<view class="xiaohui margin_top main_size">暂无数据</view>
		</view>
		<view class="mainpadding_top ffffff radius" v-for="item in list.data" :key="item.id">
			<view class="flexbetween xiahuaxian">
				<view class="titletext hei_text bold">{{item.createtime_text}}</view>
				<view class="xiaohuang bold main_size">已核销</view>
			</view>
			<view class="main_size hei_text margin_top" v-for="ite in item.goods" :key="ite.id">商品名：{{ite.title}}</view>
			<view class="flexleft main_size margin_top">
				<view class="xiaohei">数量：</view>
				<view class="xiaohuang margin_right">{{item.goods_num}}</view>
				<view class="xiaohei">合计积分：</view>
				<view class="xiaohuang">{{item.total_price}}</view>
			</view>
			<view class="main_size xiaohei margin_top">订单号：{{item.order_no}}</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				page: 1,
				limit: 12,
				list: {
					data: []
				},
			}
		},
		onLoad() {
			this.init()
		},
		methods: {
			init(isPage, page) {
				let _this = this;
				let data = {
					page: page || 1,
					limit: _this.limit
				}
				let url = '/api/order/hxIndex'
				uni.showLoading({
					mask:true,
					title:"请稍后"
				})
				httpRequest.request(url, 'GET', data, false, false, true).then(res => {
					uni.hideLoading()
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
		}
	}
</script>

<style>

</style>
